package red.service.impl;

import red.dao.ColumnDao;
import red.dao.impl.ColumnDaoImpl;
import red.model.ColumnModel;
import red.service.ColumnService;
import red.util.Model;

import java.util.List;
import java.util.UUID;

public class ColumnServiceImpl implements ColumnService {

    private ColumnDao columnDao = new ColumnDaoImpl();

    @Override
    public ColumnModel addColumn(Model model) {
        String column_name = (String) model.get("column");
        ColumnModel columnModel = new ColumnModel();
        columnModel.setColumn_name(column_name);
        columnModel.setColumn_id(UUID.randomUUID().toString());
        return columnDao.saveColumn(columnModel);
    }

    @Override
    public ColumnModel deleteColumn(Model model) {
        String column_name = (String) model.get("column");
        ColumnModel columnModel = new ColumnModel();
        columnModel.setColumn_name(column_name);
        columnModel.setColumn_id(UUID.randomUUID().toString());
        return columnDao.deleteColumn(columnModel);
    }

    @Override
    public List<ColumnModel> selectColumn(Model model) {
        ColumnModel columnModel = new ColumnModel();
        return columnDao.selectColumn(columnModel);
    }

    @Override
    public void getColumn() {

    }

}

